/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beanUser;

import com.matrimonysite.entity.UserPayment;
import com.matrimonysite.sessionbean.UserPaymentFacade;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author khanhnguyen
 */
@ManagedBean (name = "Payment")
@SessionScoped
public class payment {
    @EJB
    private  UserPaymentFacade userPaymentFacade;
    private UserPayment userPayment;
    public List<UserPayment> userPaymentList;

    public UserPayment getUserPayment() {
        return userPayment;
    }

    public void setUserPayment(UserPayment userPayment) {
        this.userPayment = userPayment;
    }
    
    
    /** private UserProfileFacade userProfileFacade;
    private UserProfile userProfile;
     * Creates a new instance of payment
     */
    public payment() {
        userPayment = new UserPayment();
        userPaymentFacade = new UserPaymentFacade();
    }
    
    public void creatUserPayment(){
        Integer str= userPayment.getPaymentID();
        userPayment.getPaymentID();
        userPayment.getUserID();
        userPayment.getPayGate();
        userPayment.getAccountID();
        userPayment.getTotalMoney();
        userPayment.getCreatedAt();
        
        //create userprofile
        userPaymentFacade.create(userPayment);
    }
    public void editUserPayment(){
        userPaymentFacade.edit(userPayment);
        FacesContext face = FacesContext.getCurrentInstance();
        face.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Update Payment Success.", "Update Payment Success."));
    }
    public void deleteUserPayment(){
        Integer str = userPayment.getPaymentID();
        userPayment.setPaymentID(str);
        userPaymentFacade.remove(userPayment);
    }
    
    public List<UserPayment> getAllUserPayment(){
        return userPaymentFacade.getAllUserPayment();
    }
}
